<extend name='layout:index'/>
<block name='content'>
<body class=""><br>
<meta name="Generator" content="ECSHOP v2.7.3">

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">

	<style>
		.user_info {
    background: #f7f7f7 none repeat scroll 0 0;
    border: 1px solid #d2d6de;
    font-family: "微软雅黑";
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
    padding: 10px;
}
	.color-red{
		
		color: #dd4b39;
	}
	.pull-right{
		margin-right: 10px;
	}
	</style>



<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="tabs-container">
   <ul class="nav nav-tabs text-center">
       <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true" style="width:300px;background-color:white;" id="a_one" onclick="f1()">已关联账号</a>
       </li>
       <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false" style="width:300px;" id="a_two" onclick="f2()">新增账号绑定</a>
	 </li>
	   </ul>
   <div class="tab-content">
       <div id="tab-1" class="tab-pane active">
           <div class="panel-body">
           	<if condition='empty($bd_user) neq true '>
           		<foreach name='bd_user' item='vo'>
           	        <div class="col-sm-4 user_info">
	              		 用户名：
						<span class="color-red" >{$vo['user_name']}</span>
						<a style='float:right'  href="__MODULE__/account/jiechu/user_name/{$vo['user_name']}">解除</a>
						<a class="pull-right"  href="__MODULE__/account/target/user_name/{$vo['user_name']}" id='user_target'>切换</a>
						
					</div>
			   </foreach>
			<elseif condition=" empty($main_user) neq true  "/>
					<foreach name='main_user' item='vo'>
					
           	        <div class="col-sm-4 user_info">
	              		 用户名：
						<span class="color-red" >{$vo['user_name']}</span>
						<a style='float:right'  href="__MODULE__/account/jiechu/user_name/{$vo['user_name']}">解除</a>
						<a class="pull-right"  href="__MODULE__/account/target/user_name/{$vo['user_name']}" id='user_target'>切换</a>
						
					</div>
			   </foreach>

			</if>

			            </div>
        </div>

       <div id="tab-2" class="tab-pane ">
           <div class="panel-body">
           <div class="col-sm-6" >
			  <div class="ibox float-e-margins">
			      <div class="ibox-content">
			          <form class="form-horizontal m-t" id="signupForm" action="__MODULE__/account/addaccount" method="post" name="theForm" onSubmit="return checkSubmit(this)" novalidate="novalidate">
			              <div class="form-group">
			                  <label class="col-sm-3 control-label">用户ID：</label>
			                  <div class="col-sm-8">
			                      <input id="userid" name="userid" class="form-control" type="text" >
			                  </div>
			                  <span id='empty_userid' color='red'></span>
			              </div>
			              <div class="form-group">
			                  <label class="col-sm-3 control-label">用户名：</label>
			                  <div class="col-sm-8">
			                      <input id="username" name="username" class="form-control" type="text">
			                  </div>
			                   <span id='empty_username' color='red'></span>
			              </div>
			              <div class="form-group">
			                  <label class="col-sm-3 control-label">密码：</label>
			                  <div class="col-sm-8">
			                      <input id="password" name="password" class="form-control" type="password">
			                  </div>
			                   <span id='empty_password' color='red'></span>
			              </div>
			              <div class="form-group">
			                  <label class="col-sm-3 control-label">安全密码：</label>
			                  <div class="col-sm-8">
			                      <input id="aqpassword" name="aqpassword" class="form-control" type="password">
			                  </div>
			                   <span id='empty_aqpassword' color='red'></span>
			              </div>
			              
			              <div class="form-group">
			                  <label class="col-sm-3 control-label" >验证码：</label>
			                  <div class="col-sm-8">
			                      <input id="code" name="captcha" class="form-control" type="text" style='width:150px;display:inline'> 
	                           <img style='width:120px;height:34px;margin-left:20px;display:inline' onclick='this.src=this.src+"?id="+Math.random();' src="__URL__/code"  alt="点击刷新">
	                           </div>
	                           	
			              </div>
	                      
	                      
			               <div class="form-group">
			                   <div class="col-sm-8 col-sm-offset-3">
			                       <button class="btn btn-primary" type="submit">确定</button>
			                   </div>
			               </div>
			           </form>
			       </div>
			   </div>
			</div>
            </div>
        </div>

                        <div id="tab-3" class="tab-pane ">
                                   <div class="panel-body">
                                                <div class="col-sm-6">
                                        		    <div class="ibox float-e-margins">
                                        			     <div class="ibox-content">

                                                            <form class="form-inline" role="form">
                                                              <div class="form-group">
                                                        <label class="col-sm-4 control-label">安全密码：</label>
                                                          <div class="col-sm-7">
                                                      <input id="pwds" class="form-control" type="password">
                                                              			     </div>
                                                           </div>
                                                          <input class="btn btn-primary" onclick="ff1(this)" value="确定" type="button">
                                                              

                                                               </form>
                                     </div>
                                              </div>
                                    </div>
                           </div>
                           
</div>
</div>


<script language="javascript">
	
 function checkSubmit()
		    {
		    	var k = false;
		        if($('#userid').val() == ''){
		             var txt=  "您 的 账 户 ID 未 填 写";
					              window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
		            return false;
		        }
		        
		        if($('#username').val() == ''){
		            var txt=  "您 的 用 户 名 未 填 写";
					              window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
		            return false;
		          }
		           if($('#password').val() == ''){
		            var txt=  "您 的 密 码 未 填 写";
					              window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
		            return false;
		          } 
		          if($('#aqpassword').val() == ''){
		            var txt=  "您 的 安 全 密 码 未 填 写";
					              window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
		            return false;
		          }   
		           if($('#code').val() == ''){
		            var txt=  "您 的 验 证 码 未 填 写";
					              window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
		            return false;
		          }             
		         $.ajaxSetup({
		             headers: {
		                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
		             }
		        });
		                
		        $.ajax({
		            type : 'POST',
		            url : '/home/account/addBangdingAjax',
		  			data : {userid:$('#userid').val(),username:$('#username').val(),password:$('#password').val(),aqpassword:$('#aqpassword').val(),code:$('#code').val()},
		            dataType : 'html',
		            async : false,
		            success : function(str){
		                if(str==2){
		                     var txt=  "验 证 码 错 误";
					              window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.info);
		                    return false;
		                }
		                 if(str==22){
		                     var txt=  "用 户 名 不 存 在";
					              window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.info);
		                    return false;
		                }
		                 if(str==222){
		                     var txt=  "安 全 码 错 误";
					              window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.info);
		                    return false;
		                }
		                 if(str==2222){
		                     var txt=  "密 码 错 误";
					              window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.info);
		                    return false;
		                }
		                if(str==22222){
		                     var txt=  "你 要 绑 定 的 账 户 已 经 被 绑 定";
					              window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.info);
		                    return false;
		                }
		                if(str==1){
		                	k = true;
		                }          
		               

		       	 	}
		        
		   	 	})
		   	 	return k;
			}

	




</script>

</div></div>

</block>
